home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 January / macformat-020.iso / Shareware City / Developers / demoCdef 120 ƒ / About CDEF's next >
Encoding:
Text File  |  1994-09-28  |  47.2 KB  |  1,198 lines  |  [TEXT/KAHL]

  1. About CDEF's…
  2.  
  3. If you have downloaded previous versions of this package, 
  4.  
  5.         READ THE REVISION HISTORY AT THE BOTTOM OF THIS DOCUMENT
  6.         
  7. some minor but important details have changed !!
  8.  
  9. Here is a collection of 10 CDEF's (Control Definitions) and some bits of
  10. source code to demo their use.
  11.  
  12. procID    Name            Function
  13. ------    -----------        --------------------------------------------------------
  14. 100        GroupBox        draws a titled box, text in upperleft
  15. 101        PopUp Menu        system 7 style popup menu control
  16. 102        Spinner            "little arrows" control
  17. 103        Date & Time        Date & Time control using "little arrows"
  18. 104        Tog Button        a new type of "one or many" control
  19. 105        HSlider            horizontal slider control
  20. 106        VSlider            vertical slider control
  21. 107*    3D Buttons        a 3d replacement for the standard button CDEF
  22. 108        Progress Bar    a progress bar CDEF
  23. 109        TabPanel        a "Tab Panel" control as in MSWord
  24.  
  25. * this CDEF has been renumbered to 0 in the xDEF.rsrc file
  26. --------------------------------------------------------------------------------
  27.  
  28. The source code for all of the CDEF's is not included here, but you can find
  29. the CDEF's as code resources in file xDEF.rsrc.
  30.  
  31. (If you are new to Mac programming, CDEF's are code resources that can just
  32. be pasted into your project's resource file and used by your programs).
  33.  
  34. The source for the "3D Buttons" CDEF is included, along with some utility
  35. routines common to all of the CDEF's.  A test harness to allow source level
  36. debugging is also included.
  37.  
  38. I have not decided if I will upload the source for the rest of the CDEF's. 
  39. I keep tweaking them at this point (a coding job is never finished) and the 
  40. full source & projects is rather large.
  41.  
  42. This file is getting pretty long, it is divided into the following sections:
  43.  
  44.     - Introduction
  45.     - Control Descriptions
  46.     
  47. CDEF details
  48.     - Variation codes & control size 
  49.     - Non-standard control RefCon usage
  50.     - Non-standard control template usage
  51.     
  52. General information
  53.     - Using custom controls in a dialog
  54.     - Using custom controls in a window
  55.     - Colorizing Controls & Dialogs
  56.     - Changing the font in a Dialog
  57.     
  58.     - About "TogButtons" 
  59.     - About Tab Panels
  60.     - Revision history
  61.  
  62. Jim Stout
  63.  
  64. September 1994
  65.  
  66. I can be reached electronically at:
  67.  
  68. Internet    : JimS@WRQ.COM    (work hours, PST)
  69. AppleLink   : WRQ            (daily)
  70. CompuServe  : 73240,2052    (weekly or so)
  71. AOL         : JasG            (weekly or so)
  72. --------------------------------------------------------------------------------
  73.  
  74. The source & executable code may be freely redistributed as long as all of the
  75. original package is included AND no specific charge is made for the package.
  76.  
  77. The CDEF's or other code in this package may be incorporated in any freeware, 
  78. shareware, commercial or other software package.
  79.  
  80. --------------------------------------------------------------------------------
  81. Introduction
  82. ============
  83.  
  84. A few weeks back I was reading the Human Interface volume of Inside Mac and it
  85. struck me as funny that Apple refers to various controls (used throughout the
  86. MacOS) as "not supported by the Toolbox".  Controls like "little arrow"
  87. controls used to set Date & Time, Memory etc., "Slider  Controls" like those in
  88. the Sound or Brightness control panels and a "Progress Bar" are simply are not
  89. to be found in the Toolbox.
  90.  
  91. Apple simulates controls by displaying appropriate PICT's and handling mouse
  92. events in a dialog filter (I think).
  93.  
  94. I realized that over the past couple of years, I had written some of those
  95. controls (the rest are hot off my coding pad).
  96.  
  97. Two of the CDEF's, 104 "Tog Button" and 109 "TabPanel" are a little different. 
  98. This is explained below in the sections "About Tog Buttons" and "About Tab 
  99. Panels.
  100.  
  101. Most of these controls will work with System 6 or System 7 - the only caveats
  102. are:
  103.  
  104.     - PopUpMenu control requires PopUpMenuSelect.  
  105.     - TabPanel control requires AppendDITL etc. (System 6 with CTB or System 7)
  106.     - 32bit ColorQuickdraw v1.2 is required for any of the controls to draw
  107.       "3D" variants and to use use the System 7 style gray when disabled.
  108.           
  109. I have tested them on machines from a MacPlus through a PowerMac 7100.
  110. (Actually, I've tested these as far back as System 3.2 - I've gotta do
  111. something with that original 128k Mac with MacPlus ROM's that  is sitting in
  112. the corner...)
  113.  
  114. All controls with titles honor the "useWindFont" variation code (to draw in a
  115. non-System font) and if possible, the controls will honor control colors found
  116. in 'cctb' resources.
  117.  
  118. The "3D Buttons" and "TabPanel" CDEFS will always use a "3D" effect if the
  119. background color is non-white AND the control can draw itself in color. 
  120. This behavior cannot be overridden for these controls.  Sorry.
  121.  
  122. As far as I can tell, the controls all handle low memory situations by 
  123. refusing to draw themselves.  Let me know if you see any problems.
  124.  
  125. I have not written these to support non-roman script systems.
  126.  
  127. Other variation codes, sizes and non-standard control template values are
  128. listed below.
  129.  
  130. --------------------------------------------------------------------------------
  131. Control Descriptions
  132. ====================
  133.  
  134. Common features:
  135.  
  136.     - color per 'cctb' resources.
  137.     - disable with "GrayishTextOr" effect under System 7.
  138.     - have an embossed, 3D variation.
  139.     - respect the "useWindFont" variation code (8).
  140.     - All control drawing is clipped to the control rect, so it should be
  141.       pretty obvious if you have a control rect that is too small.
  142.     
  143.     NOTE: all controls rely on a private data structure stored in
  144.           the contrlData field of the control structure.  Don't
  145.           use this field for your own use or unpredictable things
  146.           will happen.
  147.           
  148.           Also, some of the controls look at the value of the refCon when
  149.           initializing to get some extra parameters.
  150.           
  151.           If you want to place a value in the refCon for your program's use, 
  152.           don't set it until AFTER you call NewControl or NewDialog and
  153.           the controls have been initialized. (The DateTime CDEF is a MAJOR
  154.           exception - see below - it uses the refCon for its "value" field.)
  155.             
  156. GroupBox
  157.  
  158.     This control is pretty simple. It frames the control rect and places
  159.     the title in the upper left corner.
  160.     
  161.     It can be used to logically group a series of related controls.
  162.     
  163.     It does not respond to mouse clicks, it does have variation
  164.     codes for a dashed-line frame and a 3D effect.
  165.     
  166.     To use this control, you have to play some games with the control
  167.     rect to keep it from overlaying other controls.  Essentially, you
  168.     must set the control rect height to include ONLY the title and then
  169.     specify the true height of the control in the contrlMax field.
  170.     
  171. PopUp Menu
  172.  
  173.     This control was written to replace both the System 6 & 7 versions of
  174.     the Apple CDEF 63.  Apple's CDEF has some problems - it behaves 
  175.     differently under System 6 and 7, does not respect 'mctb' (menu
  176.     color) resources for menu items.
  177.  
  178.     The handle stored in the contrlData field is as documented by Apple
  179.     and can be used to retrieve the MenuHandle of the the popup menu.  See
  180.     IM VI and the jimsCDEF.h file.
  181.     
  182. Spinner
  183.  
  184.     This a control that "Apple never wrote".  It allows for adjustment of
  185.     a numeric value via "little" arrows.
  186.     
  187.     The default increment is 1, but this can be specified in the control
  188.     template in the refCon field.  The control value will increment in
  189.     a "ballistic" manner - as the mouse button is held down, the increment
  190.     value will increase from 1 to 10 to 100.
  191.     
  192.     This CDEF can be "linked" to a dialog edit text item to update.
  193.     
  194.     CDEFs cannot get keyDown events, so the trick here is to have the
  195.     CDEF update the edit text item.  To do this, set the HiWord of
  196.     control refCon to a DITL editText item number to be updated.  In
  197.     this case, set the LoWord of the refCon to the desired increment.
  198.     
  199.     The calling program must take care of insuring that only digits
  200.     are typed into the edit text. ALSO, when the user types new
  201.     digits, the calling program must get the contents of the edit item,
  202.     convert it to a number and call SetCtlValue to let the control
  203.     know about the new value.  Otherwise, the next click in the 
  204.     control will wipe out the typed value.
  205.     
  206.     The handle stored in the contrlData field is documented in the
  207.     jimsCDEF.h file.  There is a "userData" field for your use.
  208.     
  209.     PartCodes returned via TrackControl are :
  210.         2 - in up arrow
  211.         3 - in down arrow
  212.         
  213.     (the control will have updated its value when TrackControl returns)
  214.     
  215. Date & Time
  216.  
  217.     This is a control to adjust Date and/or Time values.  Clicking on
  218.     a time or date component (month, hours, etc.) will hilite 
  219.     those digits and show "little" arrows that can be used to adjust 
  220.     the date or time value.
  221.     
  222.     Variation codes can specify display of Date, Time, both, horizontal 
  223.     or vertical display.  The m/d/y order of the date will match what 
  224.     the user has set in the Date & Time control panel.  Leading zeros
  225.     are always drawn - it makes things a lot simpler for the CDEF.
  226.     
  227.     Likewise, 12 or 24 hour time is taken from the system settings. To
  228.     force a 24 hour setting, pass a non-zero contrlMax in the control 
  229.     template. To get a "3D" effect for the control title and arrows, 
  230.     pass a non-zero contrlMin in the control template.
  231.     
  232.     The "value" of the control is a DateTimeRec.  Since this is a long,
  233.     it is stored in the contrlRfCon field, NOT in the contrlValue field
  234.     of the control record. So, rather than using GetCtlValue(), use
  235.     GetCRefCon() to access the control value.
  236.     
  237.     There is no keyboard handling for setting date & time.  CDEF's do
  238.     not have any mechanism for keyboard events.  I think that this could
  239.     be done from a user program, but I'll leave that as an exercise for
  240.     those that need it. 
  241.     
  242.     (Hint, the contrlValue is always the hilited digits field and you can 
  243.     change the date & time shown by the control    by setting a new DateTimeRec 
  244.     into the control RefCon and drawing the    control.)
  245.     
  246.     Resetting the date and time requires the following:
  247.     
  248.                 GetDateTime(&secs);
  249.                 SetCRefCon(hCtrl, secs);
  250.                 InvalRect(&(**hCtrl).contrlRect);
  251.     
  252. Tog Button
  253.  
  254.     This is explained in great detail below.
  255.     
  256.     A "Tog" button is a diamond shaped control, a mix of CheckBox and
  257.     Radio button behavior.  A group of these controls can have many
  258.     "on" members (like a checkbox), but must always have one member
  259.     that is "on" (like a radio button).
  260.     
  261.     This file requires use of some support routines in TogLib.c that
  262.     must be called by your program.
  263.     
  264.     Variation code 4 in the 3D Buttons control will have the same
  265.     result.
  266.     
  267. HSlider
  268.  
  269.     This is an exact duplicate of the slider control in the Brightness
  270.     Control Panel.
  271.     
  272.     Several variation codes are available to alter the appearance of
  273.     the control.  See below or the demo program.
  274.     
  275.     This and the VSlider control will call back to an "actionProc" if
  276.     one is set via SetCtlAction() and you call TrackControl with -1 as
  277.     the last parameter.  This could be used to implement a "live" 
  278.     display of the control value as the thumb is dragged around.
  279.     
  280.     Part codes returned to TrackControl are :
  281.         1 - in "thumb"
  282.         2 - in "decrease"
  283.         3 - in "increase"
  284.  
  285. VSlider
  286.  
  287.     This is an exact duplicate of the slider control in the Sound
  288.     Control Panel.
  289.  
  290.     Several variation codes are available to alter the appearance and
  291.     behavior of the control.  See below or the demo program.
  292.     
  293.     See notes above for "actionProc" & TrackControl issues.
  294.     
  295. 3D Buttons
  296.  
  297.     Source is included for this control.
  298.     
  299.     This is a replacement for the standard CDEF 0 (which supplies
  300.     controls for check boxes, radio buttons, push buttons).  An 
  301.     addition is variation code 4 - in this control it supplies a
  302.     "Tog" button.
  303.     
  304.     It provides 3D equivalent to the standard controls.  The push
  305.     button variation is a square edged, raised button.  Text is
  306.     "embossed".
  307.     
  308. Progress Bar
  309.  
  310.     This is a control to provide a "thermometer" or "barber pole"
  311.     indicator. It can be used to display the progress of a long 
  312.     running operation (like the thermometer in the "Copying file…" 
  313.     alert.  The "barber pole" variation can be used when the
  314.     operation is proceeding, but the end point is not known - like
  315.     searching for a series of files.
  316.     
  317.     Variation codes can be used for horizontal, vertical, rectangular,
  318.     oval or barber pole indicators.
  319.     
  320.     
  321. TabPanel
  322.     
  323.     This too, is explained in great detail below.
  324.     
  325.     This is a problematic control.  It will be too "Windows-like" for
  326.     many.  I wrote it to see if it could be done on the Mac after seeing
  327.     what a co-worker was doing.  Don't use it if you don't like it.
  328.     
  329.     It draws a box with a series of "tabs" long the top edge, like At Ease
  330.     in some respects.  It could be used to provide a dialog with multiple
  331.     "panels" - like the Think Project Manager "Options" dialog which uses
  332.     a popup to switch panels, or many CommToolbox tools which use a list
  333.     of icons. 
  334.     
  335.     Clicking on a "tab" will change the control value. Your program can
  336.     then change the other controls on the panel - either by hiding/showing
  337.     controls or using ShortenDITL/AppendDITL calls.
  338.         
  339.     To use this control, you have to play some games with the control
  340.     rect to keep it from overlaying other controls.  Essentially, you
  341.     must set the control rect height to include ONLY the tab titles and
  342.     then specify the true height of the control in the contrlMin field.
  343.  
  344. --------------------------------------------------------------------------------
  345. CDEF details
  346. --------------------------------------------------------------------------------
  347.  
  348. See file jimsCDEF.h for #defines for variation codes and structs for private
  349. data for Spinner & Popup menu CDEFs.
  350.  
  351. Variation codes & control size 
  352. ==============================    
  353.  
  354. (min h & w is minimum required height & width for the control rect 
  355. when using Chicago 12 font)
  356.  
  357. CDEF        varCode        min h & w    Result
  358. ---------    ----------    ----------    --------------------------------------------
  359. GroupBox    0            16 x nn        Draws a solid frame
  360.             1                        Draws a dotted frame
  361.             2                        3D effect
  362.             4                        * not used *
  363.             8                        Use the Window font for title
  364.             
  365.             NOTE: To avoid problems with "layering" of this control over or
  366.                   under the contents of a box, set the height of this control 
  367.                   to 16 or so, then put the height you REALLY want in the 
  368.                   contrlMax field of the CNTL template.  The control rect 
  369.                   (used by the Dialog Manager) will not obstruct other controls.
  370.                   However, when the control draws - it will use the height value
  371.                   from the contrlMax field.
  372.                   
  373.                   Uses cFrameColor & cTextColor from 'cctb'
  374.                   
  375. --------------------------------------------------------------------------------            
  376. PopUp Menu                19 x nn        (see IM VI or docs for Apple CDEF 63
  377.                         19 x 25        for "triangle only" menu
  378.             1                        use fixed width for menu
  379.             2                        3D effect
  380.             4                        use RefCon for AddResMenu
  381.             8                        Use the Window font for title & menu
  382.             NOTE: if the menu has styled text items, the height may need to be 
  383.                   greater than 19.
  384.                   Unlike the Apple CDEF 63, this control will:
  385.                     - behave the same with System 6 & 7
  386.                     - properly handle colored menus
  387.                   It DOES NOT support:
  388.                     - Icons or cmd keys
  389.                     - Styled text titles
  390.                     
  391.                   Uses cTextColor for title and colors from 'mctb' for menu.
  392.                   
  393. --------------------------------------------------------------------------------    
  394.  
  395. Spinner        0            18 x nn        Small, as in "Date & Time" Control panel
  396.             1            25 x nn        Large, as in "Memory" Control panel
  397.             2                        3D arrows
  398.             4                        * not used *
  399.             8                        Use the Window font for drawing
  400.             
  401.             NOTE: use 18 x 11 or 25 x 15 to get arrows only.
  402.                   3D arrows are colored, as are system scroll bars, with
  403.                   with cTingeLight & cTingeDark.
  404.                   
  405. --------------------------------------------------------------------------------    
  406.  
  407. Date & Time    0            18 x 160    Date left, Time right justified    
  408.             1            18 x 80        Date only, left justified    
  409.             2            18 x 80        Time only, left justified    
  410.             4            37 x 80        Both on 2 lines, date over time
  411.             8                        Use the Window font for drawing
  412.                         
  413.             NOTE: non-standard date or time separator characters may   
  414.                   need a larger rect.  Also, if a title is specified,
  415.                   the width of the control will need to be increased.
  416.                   
  417.                   Uses cFrameColor & cTextColor.  3D arrows colored
  418.                   with cTingeLight & cTingeDark.
  419.                   
  420. --------------------------------------------------------------------------------    
  421.                                 
  422. Tog Button    0            18 x nn        Normal button title
  423.             1                        * not used *
  424.             2                        * not used *
  425.             4                        * not used *
  426.             8                        Use the Window font for title
  427.             
  428.                   Uses cFrameColor & cTextColor from 'cctb'
  429.                   
  430. --------------------------------------------------------------------------------    
  431.                         
  432. HSlider        0            24 x 121    As in the "Brightness" Control panel
  433.             1                        Scale drawn in bg color (not filled)
  434.             2                        Drawn with a 3D effect
  435.             4                        Scale drawn in gray pattern
  436.             8                        * not used *
  437.             
  438.                   Uses cFrameColor & cTextColor from 'cctb'
  439.                   
  440. --------------------------------------------------------------------------------    
  441.  
  442. VSlider        0            105 x 42    As in the "Sound" Control panel
  443.             1                        Scale drawn in bg color (not filled)
  444.             2                        Drawn with a 3D effect
  445.             4                        "Thumb" will not "snap" to tick mark
  446.             8                        Scale is blank, no numbers, no marks
  447.             
  448.             NOTE: ht is 12*divisions + 21 (see below)
  449.                   Uses cFrameColor & cTextColor from 'cctb'
  450.                   
  451. --------------------------------------------------------------------------------    
  452.  
  453. 3D Buttons    0            any x any    draws a push button
  454.             1                        draws a checkbox
  455.             2                        draws a radiobutton
  456.             4                        draws a Tog Button control
  457.             8                        Use the Window font for title
  458.             
  459.             NOTE: This control should behave just like the standard CDEF 0 when 
  460.                     running in 1 bit (B&W) mode OR if the background is white. If 
  461.                     running on a non-white background, this CDEF will draw "3 D" 
  462.                     controls.
  463.                     
  464.                   Uses cFrameColor & cTextColor from 'cctb'. Gray shading is a
  465.                   gray that is intermediate to the background color & cFrameColor.
  466.                   
  467. --------------------------------------------------------------------------------    
  468.  
  469. Progress Bar 0            any x any    draws a horizontal progress bar
  470.              1                        draws a vertical progress bar
  471.              2                        draws a rounded, 3D progress bar
  472.              4                        draws a "Barber Pole" progress bar
  473.              8                        not used
  474.              
  475.             NOTE: to get a "Barber Pole" variation to work, you need to call
  476.                     it with a different value each time.  Simply setting min=0
  477.                     and max=1, then setting its value to 0, then 1, then 0 etc.
  478.                     inside your loop operation will work.
  479.           
  480.                     'cctb' resource entries for cFillPat and cTingeLight are used
  481.                     to color this control.
  482.                     
  483. --------------------------------------------------------------------------------    
  484.  
  485. Tab Panel     0            20 x nn        draws a "Tab Panel", uses Geneva 9
  486.                                      for tab titles.
  487.              1                        Use System font for tab titles.
  488.              2                        Force a single panel (1 row of tabs).
  489.              8                        Use the Window font for tab titles.
  490.     
  491.             NOTE: To avoid problems with "layering" of this control over or
  492.                   under the contents of a box, set the height of this control to
  493.                   16 * rows, then put the height you REALLY want in the contrlMin 
  494.                   field of the CNTL template.  The control rect (used by the 
  495.                   Dialog Manager) will not obstruct other controls.  However, 
  496.                   when the control draws - it will use the height value from the 
  497.                   contrlMin field.
  498.                   
  499.                   Uses cFrameColor & cTextColor from 'cctb'. Gray shading is a
  500.                   gray that is intermediate to the background color & cFrameColor.
  501.  
  502. --------------------------------------------------------------------------------    
  503.             
  504. Non-standard control RefCon usage
  505. ===================================
  506.  
  507. Note: Several of these controls use the control refcon field.  They are:
  508.  
  509. PopUp Menu     - use of refcon is identical to Apple's CDEF 63
  510.             - not used by control after initialization.
  511.                     
  512. Spinner        - refcon may be used to indicate an "increment" value.  Also,
  513.               you can set both an increment and a DITL item (for an edit
  514.               text item to update). See below.
  515.             - the increment value is limited to 1-1000 and the DITL item
  516.               number must be 0-100.
  517.             - not used by control after initialization.
  518.                     
  519. VSlider     - refcon may be used to indicate the number of divisions 
  520.               but will default to 7 divisions.  Must be in the range
  521.               2-20.
  522.             - not used by control after initialization.
  523.                     
  524. DateTime    - refcon is the "value" of the control.  It is updated
  525.               by the control.
  526.             - ** USED ** by control after initialization - see below.
  527.                 
  528. Tab Panel    - refcon is a "right margin".  If zero, tabs will fill
  529.               the entire width of the control.  This value must be
  530.               between 0 and control width/2.
  531.             - not used by control after initialization.
  532.                     
  533. --------------------------------------------------------------------------------
  534.  
  535. Non-standard control template usage
  536. ===================================
  537.                 
  538. GroupBox        does not use min, value or rfCon. max is used for the
  539.                 true height of the control.
  540.                 
  541.                 Rect should be set to 16 pixels, just enough for the title.
  542.  
  543. PopUp Menu        (see Inside Mac VI or other docs for Apple CDEF 63)
  544.                 Briefly:
  545.  
  546.                 procId    : 1616 + varCode  (101 * 16) + varCode
  547.                         : varCodes
  548.                             popupFixedWidth        = 0x0001
  549.                             ctl3D                = 0x0002
  550.                             popupUseAddResMenu    = 0x0004
  551.                             popupUseWFont        = 0x0008
  552.                             
  553.                 value    : title justification
  554.                            :     popupTitleLeftJust        = 0x00000000
  555.                          :     popupTitleCenterJust    = 0x00000001
  556.                          :     popupTitleRightJust        = 0x000000FF
  557.  
  558.                 min        : resId of menu to use, even if using 
  559.                           popupUseAddResMenu, it is best to have a 
  560.                           'dummy' menu resource with no items defined.
  561.  
  562.                 max        : width of title item - from controlRect.left  
  563.                         :  0 = no title drawn.
  564.                         : -1 = draw 'popUp symbol' only
  565.  
  566.                 refCon    : if varCode of popupUseAddResMenu, put the 
  567.                           ResType    in the refCon field of the control.
  568.                             
  569.                 Does NOT support menu icons or cmd-keys, the menu
  570.                 can have them, but the control will not draw them.
  571.  
  572. Spinner            standard use of min, max and value.
  573.                 
  574.                 The control refCon field can be set to a long word 
  575.                 that indicates both the increment to use and a DITL 
  576.                 item to    update (optional).
  577.                 
  578.                 LOWORD = increment value (default increment is 1)
  579.                 HIWORD = DITL item number for an editText item to 
  580.                          update with the control value.
  581.                         
  582. Date & Time        max - if non-zero, reverse 12/24 hour setting.
  583.                 min - if non-zero, draw "3D" control.
  584.                 
  585.                 contrlValue indicates hilited digits
  586.                 1    hours
  587.                 2    minutes
  588.                 3    AM/PM
  589.                 7    month  (7,8,9 match user order from Control Panel
  590.                 8    day        and may not have these meanings)
  591.                 9    year
  592.                                     
  593.                 contrlRfCon is seconds as passed to GetDateTime(),  
  594.                 Secs2Date() and Date2Secs() calls.  This is the "value" 
  595.                 that the control adjusts.  Use GetCRefCon() to retrieve 
  596.                 the "date time" value and SetCRefCon() to set it.
  597.                         
  598. HSlider            min = 0, max = 100 - these are set by the control.
  599.  
  600.                 value returned will range from 0 to 100
  601.  
  602. VSlider            refCon is used to indicate 'number of divisions' from 
  603.                 2-20. Default is 7 divisions with tick marks from 0-7.
  604.                 min = 0
  605.                 max = 12*"number of divisions"
  606.                         
  607.                 The value returned will range from 0 to max.
  608.                         
  609.                 The control "thumb" will "snap" to a tick mark.
  610.                 This means that the value will always be 12*tick mark.
  611.  
  612.                 To avoid the "snap" behavior, use varCode 4.
  613.                         
  614. 3D Buttons        standard use of all fields, but with an 
  615.                 additional variation code for "Tog" buttons.
  616.                 
  617. Progress Bar    standard use of all fields.
  618.  
  619.                 Control cannot be disabled.
  620.  
  621. Tab Panel        min        = true height of the control. 
  622.                 max        = number of tabs
  623.                 value    = "active" tab. Title is bold.
  624.                 title    = one per tab, separated by CR (0x0d)
  625.                 refCon    = right margin - no tabs drawn in this area.
  626.                 
  627.                 Rect should be set to #rows * 16 pixels, just enough for 
  628.                 all rows of tabs.
  629.                 
  630.                 Control cannot be disabled.
  631.  
  632. --------------------------------------------------------------------------------
  633.  
  634. Using custom controls in a dialog
  635. =================================
  636.  
  637. To use custom controls in a dialog, it is important to understand the
  638. interaction between the Dialog Manager, Control Manager and resource
  639. definitions for dialogs.
  640.  
  641. Underlying all controls in a Macintosh window (dialog or other) is the Control
  642. Manager.  Fundamental to this is the Toolbox call to create a new control:
  643.  
  644. ControlHandle ch;
  645.  
  646. ch = NewControl(
  647.             theWindow,        the window the control belongs to
  648.             *theRect,        rectangle for control
  649.             title,            title for control
  650.             visible,        initially visible or not
  651.             initialValue,    control value
  652.             min,            minimum value
  653.             max,            maximum value
  654.             ctrlType,        16*procID+variation code
  655.             refCon            user specified value
  656.             );
  657.  
  658. ctrlType is an important value and an understanding of its use if key to the
  659. use of custom controls.  The procID is the resource id of a code resource of
  660. type 'CDEF'.  Built into the Macintosh system are 'CDEF' resources of id 0 and
  661. 1 (and others).  The 'CDEF' with procID=0 is used for push buttons, check boxes
  662. and radio buttons - with variation codes of 0, 1 and 2 respectively.
  663.  
  664. So, to create buttons in a window, you could use NewControl and specify:
  665.  
  666.                            = 16*procID+variation code
  667.                            --------------------------
  668. Push Button        : ctrlType = 16*0+0 = 0
  669. Check Box        : ctrlType = 16*0+1 = 1
  670. Radio Button    : ctrlType = 16*0+2 = 2 
  671.  
  672. A special variation code of useWindFont (8) can be used with many controls to
  673. change the font of the control.
  674.  
  675. So, to use a custom control, you simply specify a procID of something other
  676. than 0.  If you want to substitute a custom control (like the 3D Button CDEF)
  677. for the default CDEF id=0, include a CDEF with id=0 in your application's
  678. resource fork.  This was done in the demo program (and in the xDEF.rsrc file).
  679.  
  680. Items in a dialog are specified in resource description files (.r files) using
  681. a syntax unique to your resource compiler.  A dialog resource is composed of a
  682. 'DLOG' resource and a corresponding 'DITL' resource. The 'DLOG' resource
  683. defines the dialog itself, while the 'DITL' resource  defines the item list for
  684. the dialog.  A typical item description in  a 'DITL' source file might be:
  685.  
  686. resource 'DITL' (128) {
  687. /*    Control Rect,            ctrlType,     flag,        title            */
  688. /*    ---------------------    -----------    ---------    --------------- */
  689.     {249, 396, 269, 455},    Button         { enabled, "OK"             },
  690.     {249, 324, 269, 383},    Button          { enabled, "Cancel"            },
  691.     {52, 22, 68, 142},        CheckBox     { enabled, "Check box"        },
  692.     {76, 22, 92, 142},        RadioButton { enabled, "Radio button"    }
  693. };
  694.  
  695. For some standard controls (push buttons, radio buttons etc.), there are
  696. special 'DITL' definitions, as shown above.  The Dialog Manager reads the
  697. information in the 'DITL' resource, fills in some default values and calls
  698. NewControl().  (The 'enable' flag is not really a parameter to NewControl(),
  699. but sets the contrlHilite field in the control record.)
  700.  
  701. This means that you don't have to fill in the entire parameter list for
  702. NewControl() to have a control in a dialog - for the standard controls.
  703.  
  704. If you want to use the useWindFont variation code or a custom control in a
  705. dialog, there is some extra work to do…  You must define a special type of
  706. 'DITL' item, "Control" instead of "Button" etc. and then you must provide a
  707. matching resource of type 'CNTL'.  The Dialog Manager will recognize this type
  708. of 'DITL' item and read the 'CNTL' resource to get some of the parameters it
  709. will use in the call to NewControl().
  710.  
  711. The 'CNTL' resource contains fields for all of the parameters needed by
  712. NewControl().  In the example below, the DITL is changed to add the useWindFont
  713. variation to the items shown above, the resource  description would look like:
  714.  
  715. resource 'DITL' (128) {
  716. /*    Control Rect,            ctrlType,     flag,        'CNTL' id        */
  717. /*    ---------------------    -----------    ---------    --------------- */
  718.     {249, 396, 269, 455},    Control         { enabled,        128         },
  719.     {249, 324, 269, 383},    Control     { enabled,        129            },
  720.     {52, 22, 68, 142},        Control     { enabled,        130            },
  721.     {72, 22, 88, 142},        Control        { enabled,        131            }
  722. };
  723.  
  724. /*    Control Rect    initValue    visFlag        max    min    ctrlType    refCon    Title */
  725.  
  726. resource 'CNTL' (128, purgeable) {
  727.     {52, 22, 68, 142},        0,    visible,    1,    0,    16*0+8,        0,        "OK"
  728. };
  729. resource 'CNTL' (130, purgeable) {
  730.     {52, 22, 68, 142},        0,    visible,    1,    0,    16*0+8,        0,        "Cancel"
  731. };
  732. resource 'CNTL' (130, purgeable) {
  733.     {52, 22, 68, 142},        0,    visible,    1,    0,    16*0+1+8,    0,        "Check box"
  734. };
  735. resource 'CNTL' (131, purgeable) {
  736.     {72, 22, 88, 142},        0,    visible,    1,    0,    16*0+2+8,    0,        "Radio button"
  737. };
  738.  
  739. ** IMPORTANT **
  740.  
  741.     There are TWO rectangle definitions here - one in the 'DITL' and 
  742.     one in the 'CNTL'.  If they don't match, your custom control may
  743.     not draw, or it will flicker and seem to move when you first
  744.     show the dialog.  Also, clicks in the DITL rect may not be 
  745.     recognized by the Control when its rect is different. 
  746.     
  747.     Make sure the rects match.
  748.  
  749. If you use a resource editor instead of .r files & a resource compiler, you can
  750. define the 'DITL' and matching 'CNTL' resources directly. Resorcerer does a
  751. fine job at this.  ResEdit is a bit more difficult to use.
  752.  
  753. ResEdit does not keep the 2 rectangles in sync, if you drag a 'DITL' item
  754. around, the corresponding 'CNTL' is not updated.
  755.  
  756. To use ResEdit, open the 'DITL' window and define a new item of type "Control"
  757. from the floating palette.  Double click on the new item and fill in the
  758. resource id and rectangle information.  Move this window aside, but so that you
  759. can still see the rect info.
  760.  
  761. Now, hold down the command+option keys and double click on the item in the
  762. 'DITL' window.  This brings up the 'CNTL' window where you  can fill in the
  763. info for the 'CNTL' resource - fill in the "Bounds Rect" (top, left, bottom,
  764. right) item to match the rect in the 'DITL' window.
  765.  
  766.  
  767. --------------------------------------------------------------------------------
  768. Using custom controls in a normal window
  769. ========================================
  770.  
  771. In some ways, it is easier to use a control in a normal window than in a dialog.
  772. BUT, you have to do mouseDown event processing since the Dialog Manager is not
  773. doing it for you.
  774.  
  775. This is simple and identical to handling scroll bars or buttons in a window.  Just
  776. call FindControl to determine where & if the mouse was clicked in a control, then
  777. call TrackControl.  The code is nothing special, it looks like this:
  778.  
  779.             mousePt = theEvent->where;
  780.             GlobalToLocal(&mousePt);
  781.             partCode = FindControl(mousePt, theDialog, &controlHdl);
  782.             if(partCode && controlHdl) {
  783.                 TrackControl(cHdl, mousePt,  (ProcPtr)myTrack);
  784.             }
  785.             
  786. The only special things about these controls have to do with the last parameter to
  787. TrackControl - the actionProc.  Normally, you can simply take the default
  788. and pass nil as the last parameter.
  789.  
  790. Exceptions are:
  791.  
  792. Popup Menu
  793. ----------
  794.     You must pass (ProcPtr)-1 to tell the CDEF to "autoTrack".
  795.  
  796. Spinner
  797. -------
  798.     You may define an actionProc which will be called when the mouse is
  799.     clicked in an arrow.  Unlike a scrollBar, the Spinner CDEF will update
  800.     its control value.  So in your action proc, you can call GetCtlValue to
  801.     obtain the current control value and do something with it (like stuff it
  802.     in an edit text record or display it).
  803.     
  804. Sliders
  805. -------
  806.     Sliders don't really need an actionProc, you can call TrackControl with
  807.     a nil actionProc and the slider will work just fine.
  808.     
  809.     If you want to implement a "live" display of the value of a slider control,
  810.     you simply define an actionProc, but use SetCtlAction to tell the control
  811.     to call it as the "thumb" of the slider is being dragged. (You still need
  812.     to call TrackControl though, or the control will not respond to clicks
  813.     in the scale portion of the control).
  814.     
  815.     In your actionProc, you can then call GetCtlValue to obtain the control
  816.     value and display it.
  817.     
  818. For the rest of the CDEF's, simply call TrackControl with a nil action proc 
  819. (unless you want to extract the control value and do something with it each
  820. time the mouse is clicked in the control - then you must define an actionProc).
  821.  
  822. --------------------------------------------------------------------------------
  823. Colorizing Controls & Dialogs
  824. --------------------------------------------------------------------------------
  825.  
  826. The key to having a colored dialog is to include a 'dctb' (or 'actb' for Alerts)
  827. with the same ID as the 'DLOG' or 'ALRT' resource.
  828.  
  829. For controls, there is a similar resource, a 'cctb'.  Either create 'cctb'
  830. resources for each 'CNTL' resource, or to color ALL controls in an application,
  831. create a 'cctb' with ID=0.
  832.  
  833. For the controls that have a "3D" variant, make sure you define the
  834. cTingeLight and cTingeDark colors in your 'cctb' or you won't get a nice
  835. looking control.
  836.  
  837. See demoCDEF.r for examples.
  838.  
  839. --------------------------------------------------------------------------------
  840. Changing the font in a Dialog
  841. --------------------------------------------------------------------------------
  842.  
  843. Before showing your dialog (but after creating it), simple calls to:
  844.  
  845.     TextFont(geneva) and
  846.     TextSize(9)
  847.  
  848. will change the dialog font to Geneva 9.  This WILL NOT WORK if you have an
  849. edit text item in the dialog or if you forget to specify the useWindFont
  850. variation for your controls.
  851.  
  852. The best way to change the font for an edit item is to use 'ictb' resources, but
  853. these are a pain.  Only Resorcerer does this well, Rez and ResEdit don't
  854. support 'ictb' resources.
  855.  
  856. See demoCDEF.c for a crude hack that seems to work.
  857.  
  858. --------------------------------------------------------------------------------
  859. About "TogButtons" 
  860. --------------------------------------------------------------------------------
  861. In early November 1991, I ran across an article in the October 1991 "Apple
  862. Direct" by Bruce Tognazzini - Apple's human interface guru.   Each month Tog
  863. would write a column dealing with HI issues.  The article that caught my eye
  864. back then was titled "Case Study: One or more Buttons".  
  865.  
  866. I don't think that I can legally include Tog's article with this bit of code,
  867. but you can find it on many of the Apple Developer CD's in the 
  868.  
  869. Periodicals:Apple Direct:Apple Direct Oct '91:Tog folder.  
  870.  
  871. It also is in his book "Tog on Interface" as chapter 36.
  872.  
  873. To summarize, Tog wrote about the design and usability testing of a new 
  874. interface element that he called "One or more Buttons" - essentially a control
  875. that was part Checkbox and part Radio button.  A group of Checkboxes can all be
  876. "Off" and a group of Radio buttons can only have one "On" value.  What was
  877. needed was a group that MUST have ONE "On" control but could have many "On"
  878. controls - a "One or more Button".
  879.  
  880. Tog's design for what I call "Tog Buttons" is a cross between a Radio button
  881. and a Checkbox.  The control is a diamond (a Checkbox rotated 90 degrees) with
  882. a diamond shaped indicator (like the  circular indicator in a Radio button). 
  883. The behavior is also a cross between the two other controls.  If only one
  884. control is ON, then clicking on it turns that control OFF and turns on an
  885. adjacent control (just like a pair of radio buttons), if one or more of the
  886. controls is ON, then others can be toggled (just like a checkbox).
  887.  
  888. Another twist on the behavior is that if only one control is ON, a click on
  889. that control will turn if OFF, and turn on the one just above (or to the left
  890. of) it.  When the first (or last) control  is reached, the direction reverses,
  891. turning on the one just below  (or to the right).  Tog likened this behavior to
  892. that of a drop of  mercury when you press on it with a finger (but without the
  893. toxicity!).
  894.  
  895. The behavior is such that with a single ON button, clicking on just that
  896. button, causes it to "jump" up (or leftward).  If you keep chasing the single
  897. ON button, it will keep "jumping" up until it must reverse direction and start
  898. "jumping" down.  Unless you are "chasing" a button like this, when only one
  899. button is ON, the default behavior is to jump UP (or to the left).  To see
  900. this, try the cdefDemo program and you will see what I mean.   
  901.  
  902. For some reason, this appealed to me as an interesting project and I spent a
  903. fun afternoon implementing Tog's idea.  I ended up creating a CDEF to implement
  904. the control described by Tog and a couple of routines in C to support the
  905. desired behavior of "Tog Buttons".
  906.  
  907. --------------------------------------------------------------------------------
  908. How to use a Tog Button in a dialog
  909. ===================================
  910.  
  911. Obviously, using a Tog Button is only needed if you have a situation that has a
  912. group of items that requires "One or Many" values.  An example might be a
  913. search :
  914.  
  915.    - Search -----------------
  916.   |                          |
  917.   | <•> C files (.c)         |
  918.   | < > Include files (.h)   |
  919.   | < > Resource files (.r)  |
  920.   |                          |
  921.    --------------------------
  922.    
  923. The file cdefDemo.c shows how to use "Tog Buttons", but here is a brief list.
  924.  
  925. 1. Include the files TogLib.c/TogLib.h in your project.
  926.  
  927. 2. Define the group of "Tog Buttons" in your dialog resource.
  928.  
  929. 3. DITL item numbers MUST be successively numbered for each group of "Tog
  930.    Buttons".  This is IMPORTANT!
  931.  
  932. 4. After calling GetNewDialog, but before calling ModalDialog,  call
  933.    initTogButtons() for each group of "Tog Buttons".
  934.  
  935. 5. When a "Tog Button" is clicked, call setTogButtons() for that group of "Tog
  936.    Buttons".
  937.  
  938. 6. When a non-Tog Button control is clicked, do whatever is needed, then call
  939.    resetTogButtons() for each group of  "Tog Buttons".  This step simply insures
  940.    that the next click on a "Tog Button" will "go up".
  941.  
  942. 7. Use regular calls to GetDItem() and GetCtlValue() to retrieve the control
  943.    values for "Tog Buttons".
  944.  
  945. The TogLib routines are the key to maintaining consistent behavior of the "Tog
  946. Buttons".  TogLib.h has a short description of each routine.
  947. --------------------------------------------------------------------------------
  948. About Tab Panels
  949. --------------------------------------------------------------------------------
  950. Tab panels are what I call dialogs that use the TabPanel CDEF in this package.
  951.  
  952. The CDEF is modeled after what I think is Microsoft's "Tabbed dialog" interface
  953. design.  I think that this is being used in the new Mac versions of Word &
  954. Excel, but I haven't seen them yet.
  955.  
  956. It could be used as an alternative to the common Mac approach of multi-panel
  957. dialogs that use a list of Icons to switch among several panels.
  958.  
  959. This is doubtless a controversial interface element - even more so on the Mac. 
  960. I don't condone it's use, I simply wanted to see if I could write a control
  961. like this.
  962.  
  963. Think long and hard before you use this on the Mac - it may be rather foreign
  964. to Mac users and will take some thought.  One of the biggest difficulties is
  965. "Where do the OK & Cancel buttons go?" and "What does a click on a tab mean?" -
  966. should changes be applied immediately, or wait for an OK on the dialog?
  967.  
  968. If OK & Cancel are inside the "Tab" control, do you have to click on OK before
  969. changing tabs?  How do you exit the dialog?  Do you then need a "Done" button".
  970. Is a click on a tab the same as OK? and so on…
  971.  
  972. If the OK and Cancel buttons are outside the "Tab" control, then do you need an
  973. "Apply" button that must be clicked  or you loose changes if you switch panels
  974. by clicking on a  new tab?  Or is a click on a tab is that an implied
  975. acceptance of changes that will take effect when you click "OK"?
  976.  
  977. There is some subtle but important stuff here. Think about it!
  978.  
  979. Using the Tab Panel CDEF
  980. ------------------------
  981.  
  982. You can specify from 1 to 20 tabs with this control (one would be silly and
  983. 20 is probably overkill).  Tabs are presented with 4 per row by default, each
  984. tab is 1/4 of the width of the control.  If you specify a tab count that is
  985. not a multiple of 4, the remaining tabs will be larger than the others so 
  986. that the entire control width is occupied.
  987.  
  988. The control max value indicates the number of tabs. The control title should 
  989. contain a title for each tab, separated by a CR.  If you want a "margin" on 
  990. the right side with no tabs, put a "margin" value in the refCon field.  The
  991. control rect height should be set to #rows * height of 1 tab.  Then set the
  992. REAL height for the entire panel in the contrlMin field of the control
  993. template.
  994.  
  995. The height of each row of tabs is calculated as : controlHeight/rows. 16 pixels
  996. per row is a good size.  So, if you need 8 tabs, set the control rect to be
  997. 32 high.
  998.  
  999. By default, this control will use a Geneva 9 font, with the "active" tab drawn
  1000. as Bold.  If you use the useWindFont variation code of 8, it will use the current
  1001. font. A variation code of 1 will use the System font at all times, underlined 
  1002. instead of bold (IMHO, this looks better than bold Chicago 12).
  1003.  
  1004. A variation code of 2 will force a single row of tabs, with as many tabs as 
  1005. specified by controlMax, each as wide as controlWidth/# tabs.
  1006.     
  1007. If the background is not white, the control will draw as a "3D" control.
  1008.     
  1009. Please note that the control cannot  be disabled, nor can a single tab be disabled.
  1010.  
  1011. File panelAssist.c has 3 routines that might be handy - one to swap panels, one
  1012. to implement command+number keys as an alternative to clicking on a tab and one
  1013. to implement command+Tab or control-tab to cycle through the tabs.
  1014.  
  1015. If you have a situation where an entire panel should be disabled, disable each
  1016. of the controls on the panel.
  1017.  
  1018. The file cdefDemo.c shows how to use a "Tab Panel", but here is a brief list.
  1019.  
  1020. 1. Include the files panelAssist.c/panelAssist.h in your project.
  1021.  
  1022. 2. Define a dialog resource and DITL that contains just 3 controls "OK",
  1023.    "Cancel" and the TabPanel control as items 1-3.
  1024.  
  1025. 3. Define a 'DITL' resource for each tab panel.  Number them successively,
  1026.    starting with DLOGID+1.
  1027.  
  1028. 4. Study the code in cdefDemo.c.  That example places the OK & Cancel buttons
  1029.    outside the panel and saves all control values to a temp area before switching
  1030.    to another panel.
  1031.  
  1032. 5. When Modal dialog informs your program that a Tab was clicked, do the
  1033.    following:
  1034.     
  1035.         - get the value of the tab control.
  1036.         - save the values of the control on the current panel.
  1037.         - call panelSwap with the new tab value to change panels.
  1038.             (this uses CountDITL, ShortenDITL and AppendDITL)
  1039.         - restore the values of the controls on the new panel.
  1040.         
  1041. 6. If you want to use command+number keys to switch panels, call panelCmdKey()
  1042. from your dialog filter routine whenever a keyboard event occurs with the
  1043. command key down - obviously, this is only good for 10 or fewer tabs.  
  1044.  
  1045. To use command+tab or control-tab to rotate through tab panels, call 
  1046. panelCmdTab().
  1047.  
  1048. --------------------------------------------------------------------------------
  1049. Revision History:
  1050. --------------------------------------------------------------------------------
  1051.                       
  1052. v1.2    September 1994
  1053.  
  1054.                     - removed bogus UpdtDialog() call from demoCDEF.c - could
  1055.                       cause a crash and wasn't needed.
  1056.                     - minor fix to dimText.c.
  1057.                     - fixed multiple monitor color problems in CDEFs that
  1058.                       do not use offScreen drawing (3D Buttons, Popup, 
  1059.                       Tab Panel, Progress Bars & Group Box).
  1060.                     - reworked some of the common routines for CDEFs in
  1061.                       source folder "cdef Common".
  1062.                     - finally got around to checking the controls in a window
  1063.                       as opposed to a dialog.  Lots of minor tweaks to make
  1064.                       things work correctly with FindControl & TrackControl.
  1065.                       Details follow.
  1066.                     - many enhancements to the demoCDEF program to show:
  1067.                         : disabled Group Boxes
  1068.                         : Fractional increment in Spinner controls
  1069.                         : "Live" display of control values for Sliders
  1070.                         : Reset of DateTime controls to current time.
  1071.                         : Linking of a Spinner control to Progress bar.        
  1072.         
  1073.         Spinner
  1074.         -------            
  1075.         
  1076.     ** MAJOR CHANGE **
  1077.     
  1078.                     - the meaning of the refCon field has changed:
  1079.                             LOWORD is the increment value to use
  1080.                             HIWORD is the DITL item number to update 
  1081.                             
  1082.                       The refCon value is only checked when the control is first
  1083.                       initialized.  The HIWORD is only honored if the controlOwner
  1084.                       is a dialog window.
  1085.                       
  1086.                     - Spinner control has a new variation to get "3D" arrows.
  1087.                       Use varCode 2 for this.  3D arrows are colored as are
  1088.                       system scroll bars with cTingeLight & cTingeDark.
  1089.                       
  1090.                     - Spinner control now behaves correctly with TrackControl.  
  1091.                       Part codes returned are :
  1092.                           2 = decrease value
  1093.                         3 = increase value
  1094.                         
  1095.                     - it is now possible to have a spinner control that adjusts
  1096.                       by a fractional value.  This requires some special code in
  1097.                       your program (after all, the contrlValue field is a short).
  1098.                       See demoCDEF.c for an example.
  1099.                       
  1100.                       To do this, a struct is provided to let you store userData
  1101.                       in the control's internal contrlData field - which is used
  1102.                       by the control.  See jimsCDEF.h for the struct.
  1103.         Tab Panel
  1104.         ---------              
  1105.                     - Tab Panel improved to handle multiple panels of tabs.
  1106.                       It defaults to 4 tabs per panel, with a maximum of 5
  1107.                       panels.  Variation code 2 added to force a single panel.
  1108.                       Variation code 1 will force System font.
  1109.                     - added panelCmdTab() to panelAssist.c to allow cmd-Tab or
  1110.                       cntl-Tab to cycle through the tabs.
  1111.         Sliders
  1112.         -------                    
  1113.                     - Slider controls now behave correctly with Find/Track Control
  1114.                       and will call an actionProc from SetCtlAction() if set.
  1115.                       Part codes returned are :
  1116.                           1 = "thumb" adjusted value
  1117.                           2 =  value was decreased
  1118.                           3 =  value was increased
  1119.                           
  1120.                     - Slider controls : change in variation codes :
  1121.                             1 is now for "unfilled scale"
  1122.                             2 is now for "3D" effect
  1123.  
  1124.         Date & Time
  1125.         -----------
  1126.                     - DateTime control values were changed to indicate what
  1127.                       digits are currently hilited.  FindControl part codes 
  1128.                       returned are:
  1129.                           2  - Hours 
  1130.                           3  - Minutes 
  1131.                           4  - AM/PM
  1132.                           5  - TimeUp        (never as control value)
  1133.                           6  - TimeDown    (never as control value)
  1134.                           
  1135.                           7  - date 1 (per control panel)
  1136.                           8  - date 2
  1137.                           9  - date 3
  1138.                           10 - DateUp        (never as control value)
  1139.                           11 - DateDown    (never as control value)
  1140.                     
  1141.                     - DateTime control now has 2 "pseudo" variation codes:
  1142.                         : if control Max is non-zero, 24 hour time is forced.
  1143.                         : if control Min is non-zero, use 3D effect for arrows
  1144.                           & text as with the Spinner control.
  1145.         Popup Menu
  1146.         ----------
  1147.                     - Popup Menu control now recognizes variation 2 for 3D
  1148.                       effects as in Group Boxes, Sliders and Spinner control.
  1149.                       
  1150.                     - as with Apple's CDEF 63, call TrackControl with the last
  1151.                       parameter set to -1 to use this control in a regular
  1152.                       window.
  1153.         Group Box
  1154.         ---------
  1155.                     - now will disable and draw in gray.
  1156.                     
  1157. --------------------------------------------------------------------------------
  1158.           
  1159. v1.1    August 1994    - added Tab Panel CDEF to collection (see description
  1160.                       above).
  1161.                     - all CDEF's use "embossed" text if used on a non-
  1162.                       white background.
  1163.                     - DateTime control now uses a title if supplied in
  1164.                       control template.
  1165.                     - PopUpMenu control draws color title per 'cctb' 
  1166.                       rather than 'mctb' and will "emboss" as with others.
  1167.                       When the menu is "popped", the title colors are the
  1168.                       same as the inverted menu item, rather than 'cctb'.
  1169.                       colors.  IMHO, this looks better.
  1170.                     - Fixed a PenSize problem with 3D Buttons in Alerts
  1171.                       with no 'actb' resource.
  1172.                     - slider controls corrected to use proper gray when
  1173.                       inactive.
  1174.                     - slider controls now respond to clicks in the scale
  1175.                       portion of the control.
  1176.                     - variation 1 (was gray thumb) in slider controls now
  1177.                       draws a "3D" version of the control.  Shadow color
  1178.                       is cTingeLight from 'cctb'.
  1179.                     - removed a MAJOR memory leak in the slider controls.
  1180.                     - Added a "barberpole" variation to the ProgressBar.
  1181.                     
  1182.                     - completely rewrote demo program to use the TabPanel
  1183.                       control.
  1184.                       
  1185. --------------------------------------------------------------------------------
  1186.  
  1187. v1.01    July 1994    - 3D Buttons now supports multi-line titles
  1188.                     - GroupBox uses Control Max instead of RefCon for
  1189.                       true height of box (templates must be changed).
  1190.                     - both slider controls have a correction to tracking
  1191.                       logic when mouse is moved past end of slider. Now,
  1192.                       tracking will not resume until mouse is moved back
  1193.                       to the thumb.
  1194.         
  1195. --------------------------------------------------------------------------------
  1196.  
  1197. v1.0    June 1994    - first distribution
  1198.